
Partial Class Usercontrols_Controlpanel_NewUser
    Inherits UserControlBase

#Region " Enums, Memebers and Properties "



#End Region

#Region " Page Events "

	Protected Sub uxPowerKBCreateUserWizard_ContinueButtonClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles uxCreateUserWizard.ContinueButtonClick
		Dim ArrayNames() As String = {Me.uxCreateUserWizard.UserName.Trim}

		If Roles.IsUserInRole(Me.uxCreateUserWizard.UserName.Trim, "member") = False Then
			Roles.AddUsersToRole(ArrayNames, "member")
		End If

		SendingVerificationEMail()

		Response.Redirect(String.Format("{0}.aspx", AppPage))

	End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		SetPageTitle(Resources.Resource.NewUserRegistration)
    End Sub

#End Region

#Region " Save Data "



#End Region

#Region " Load Data "



#End Region

#Region " Form Controls Events "

	Protected Sub SendingVerificationEMail()

		Dim ToAddress As String = Membership.GetUser(UserID(Me.uxCreateUserWizard.UserName.Trim)).Email
		Dim FromAddress As String = MailSettingsSection.Smtp.From.ToString().Trim()
		Dim EmailBody As New StringBuilder
		Dim Subject As String = String.Format("{0} - {1}", SiteTitle, Resources.Resource.NewAccountVerification)

		EmailBody.Append("<br>")
		EmailBody.Append(String.Format("<b>{0} {1}</b>", Resources.Resource.WelcomeMessageLine1, Me.uxCreateUserWizard.UserName.Trim))
		EmailBody.Append("<br>")
		EmailBody.Append(Resources.Resource.WelcomeMessageLine2)
		EmailBody.Append(String.Format("<a href=""http://{0}{1}?pid=sec_verification&ID={2}"">{3}</a>", Request.ServerVariables("HTTP_HOST"), Request.ServerVariables("URL"), UserID(Me.uxCreateUserWizard.UserName.Trim).ToString().Trim(), Resources.Resource.AccountVerificationPage))
		EmailBody.Append("<br>")
		EmailBody.Append(Resources.Resource.WelcomeMessageLine3)
		EmailBody.Append("<br>")

		SendEmail(ToAddress, "", "", FromAddress, Subject, EmailBody.ToString().Trim(), True)

	End Sub

#End Region

#Region " Helpers and Methods "



#End Region

End Class
